package com.jwdf.uda.ui.activity;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.view.View;
import android.widget.RelativeLayout;

import com.jwdf.uda.R;
import com.jwdf.uda.view.tabstrip.AdvancedPagerSlidingTabStrip;
import com.jwdf.uda.view.tabstrip.Margins;

/**
 * Created by Administrator on 2016/5/18.
 */
public class StylistActivity extends DefaultMainActivity {

    @Override
    protected void initOtherViews() {
        findViewById(R.id.ivCenterBtn).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                StylistGuideActivity.startActivity(StylistActivity.this);
            }
        });
    }

    @Override
    protected int getLayoutIdRes() {
        return R.layout.fragment_stylist;
    }

    @Override
    protected FragmentStatePagerAdapter getPagerAdapter() {
        return new FragmentAdapter(getSupportFragmentManager());
    }

    private class FragmentAdapter extends DefaultFragmentPagerAdapter implements AdvancedPagerSlidingTabStrip.LayoutProvider {

        public FragmentAdapter(FragmentManager fm) {
            super(fm);
        }


        @Override
        public float getPageWeight(int position) {
            return 0.0f;
        }

        @Override
        public int[] getPageRule(int position) {
            if (position >= 0 && position < TAB_COUNT) {
                switch (position) {
                    case HOME_TAB_INDEX:
                        return new int[0];
                    case FIND_TAB_INDEX:
                        return new int[]{
                                RelativeLayout.ALIGN_PARENT_RIGHT};
                    case QUIZ_TAB_INDEX:
                        return new int[]{
                                RelativeLayout.ALIGN_PARENT_LEFT};
                    case INDIVIDUAL_TAB_INDEX:
                        return new int[0];
                    default:
                        break;
                }
            }
            return new int[0];
        }

        @Override
        public Margins getPageMargins(int position) {
            return null;
        }

    }

}
